var CB 
var CS 

msg "Ignore ALL exceptions!!!" 

gpa "GetModuleHandleA","kernel32.dll" 
msg "   gpa "GetModuleHandleA","kernel32.dll"      "

bp $RESULT 
msg "   bp $RESULT      "

esto 
msg "    esto     "

bc eip 
msg "   bc eip      "

rtu
msg "    rtu    "

find eip,#80A5????????FF0F843001000080A5????????FF0F8423010000# 
msg "    find eip,#80A5????????FF0F843001000080A5????????FF0F8423010000#     "

cmp $RESULT,0 
msg "   cmp $RESULT,0      "

je error 
msg "   je error      "

bp $RESULT 
msg "    bp $RESULT    "

esto 
msg "    esto     "

bc eip 
msg "   bc eip      "

sti 
msg "     sti    "

mov [eip],0130E990 
msg "   mov [eip],0130E990      "

gpa "VirtualProtectEx","kernel32.dll" 
msg "    gpa "VirtualProtectEx","kernel32.dll"     "

bp $RESULT 
msg "   bp $RESULT      "

esto 
msg "    esto     "

bc eip 
msg "    bc eip     "

rtu 
msg "    rtu     "

gmi eip,CODEBASE 
msg "   gmi eip,CODEBASE     "


mov CB,$RESULT 
msg "   mov CB,$RESULT      "

gmi eip,CODESIZE 
msg "    gmi eip,CODESIZE     "

mov CS,$RESULT 
msg "    mov CS,$RESULT     "

bprm CB,CS 
msg "    bprm CB,CS     "

esto 
msg "    esto     "

bpmc 
msg "    bpmc     "

an eip 
msg "    an eip     "

ret 
error: 
msg "Cannot find import redirection procedure!" 
ret 
